package com.woniu.orderservice.service.impl;

import com.woniu.orderservice.entity.Reasons;
import com.woniu.orderservice.dao.ReasonsDao;
import com.woniu.orderservice.service.ReasonsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("reasonsService")
public class ReasonsServiceImpl implements ReasonsService {
    @Resource
    private ReasonsDao reasonsDao;

    @Override
    public Reasons queryById(Integer id) {
        return reasonsDao.queryById(id);
    }

    @Override
    public List<Reasons> queryAllByLimit(int offset, int limit) {
        return reasonsDao.queryAllByLimit(offset, limit);
    }
   
     @Override
    public List<Reasons> findAll() {
        return reasonsDao.findAll();
    }

    @Override
    public Reasons insert(Reasons reasons) {
        reasonsDao.insert(reasons);
        return reasons;
    }

    @Override
    public Reasons update(Reasons reasons) {
        reasonsDao.update(reasons);
        return queryById(reasons.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return reasonsDao.deleteById(id) > 0;
    }
}